Skip to content

fix(subagents): keep print-host parents from settling without wait - #515

Open
tt-a1i wants to merge 2 commits into
mainfrom
research/openpi-cursor-reliability-20260908
Open

fix(subagents): keep print-host parents from settling without wait#515
tt-a1i wants to merge 2 commits into
mainfrom
research/openpi-cursor-reliability-20260908

Conversation

@tt-a1i

@tt-a1i tt-a1i commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • --print / --mode json cannot re-invoke the parent after agent_settled. Stock spawn text still tells the model it may end the turn; required child results are lost (E high-fast 3/10 print-settle failures).
  • Non-TUI hosts now get spawn text that requires subagent_wait, plus a bounded followUp + triggerTurn barrier if the parent settles while direct children are running. Interactive TUI guidance is unchanged.
  • Same E task+acceptor on cursor-grok-4.6-high-fast: 7/10 before (v0.8.1 stock) → 10/10 after. Isolated bun run check and bun run test pass. Closes nothing; tracks bug(subagents): --print/--json parent can settle while required children are still running [under investigation] #512. Do not merge from this reliability session unless a maintainer asks.

Test plan

  • tests/extensions/subagents/print-host.test.ts and prompt contract
  • bun run check && bun run test in isolated v0.8.1 worktree
  • Real-model E high-fast n=10 after on the same acceptor
  • Reviewer: confirm TUI fire-and-forget still says “end your turn”
  • Reviewer: confirm print/json spawn result does not

--print/--json cannot re-invoke after agent_settled, so spawn text that
tells the model to end the turn drops required child results. Require
subagent_wait on non-TUI hosts and send a bounded follow-up barrier.
@github-actions github-actions Bot added documentation Improvements or additions to documentation area:subagents Subagent delegation, skills, or tests labels Sep 8, 2026
Correct E-06..10 as pre-fix, point at bun/unit logs and hang issue #516,
and keep the reliability notes from being read as a Benchmark.

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review at exact head a10103d. I cannot formally request changes on a PR authored by this account, but the following are merge-blocking.

Standards

[P1] Print-host completion is still prompt-enforced rather than runtime-enforced. The agent_settled handler injects at most two “MUST call subagent_wait” follow-ups and then allows settlement while children may still run. The 10/10 experiment validates that the improved spawn wording influences this model; it does not establish a fail-closed lifecycle barrier.

[P1] runningDirectIds duplicates manager lifecycle state and misses valid transitions. A fast child can settle before the ID is added after spawn, leaving a stale running ID; a settled child restarted through subagent_send is never re-added. Please derive this state from the manager rather than maintaining a parallel Set.

Spec

[P1] Restarted direct children receive neither print-host wait guidance nor barrier tracking, so their required result can still be lost when the parent exits.

[P1] The fallback calls fire-and-forget pi.sendMessage() from agent_settled. Pi print mode can finish the original prompt and dispose before that nested turn completes; current tests assert pure helpers and the experiment runs all obeyed the earlier spawn guidance, so the fallback path has no end-to-end evidence.

[P2] The barrier counter is Session-global and never resets per spawn/batch, and RPC is included without protocol-level validation. The draft research records are also indexed under “Validated investigations.”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:subagents Subagent delegation, skills, or tests documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant